﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Configuration;

namespace WindowsFormsApplication3
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            string extPath = Application.ExecutablePath;
            Configuration config = ConfigurationManager.OpenExeConfiguration(extPath);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            FormLogin frmLogin = new FormLogin();
            DialogResult dr = frmLogin.ShowDialog();
            if (dr == DialogResult.OK)
            {
                bool bSucceed = Convert.ToBoolean(System.AppDomain.CurrentDomain.GetData("Succeed"));
                if (bSucceed)
                {
                    Application.Run(new FormMain());
                }
                // (system.appdomain.currentdomain.getdata("username") as textbox).text = "test";
                //if (frmlogin.getusername() == "admin" && frmlogin.password == "admin")
                //{
                //    messagebox.show("恭喜你，登录成功！");
                //    if (frmlogin.isusersaving)
                //    {
                //        config.appsettings.settings.add("user", frmlogin.username);
                //    }
                //    else
                //    {
                //        config.appsettings.settings.remove("user");
                //    }
                //    config.save(configurationsavemode.modified);
                //}
                //else
                //{
                //    messagebox.show("恭喜你，登录失败，请与网管联系！");
                //    frmlogin.username = "";
                //    frmlogin.password = "";
                //    frmlogin.setfocus();
                //}

            }
        }
    }
}
